import time, random

setGlobalDuration(20)

pitches = [random.randint(50,100) for i in range(1000)]

a = genDataFileTable(pitches)

oscReceive(bus='init', address='/init', port=8000)

discreetTableLoop(bus='pit', table=a, speed=.06125, reinittrigbus='init')

sine(pitch=10, pitchVar='pit', amplitude=.5)

proc = startCsound()

time.sleep(1)

def newPitches():
    pitches = [random.randint(100,200) for i in range(15000)]
    reGenDataFileTable(a, pitches, proc)

pat = pattern(time=2, function=newPitches)
pat.start()
pat.play()

def t():
    sendOscTrigger(value=1, address='/init')
